<template>
  <div class="navplay">
    <div class="nav-box">
      <div class="nav-contain">
        <div>
          <div class="con-bg"></div>
          <div
            class="cont-list"
            v-for="(item, index) in navPlayData"
            :key="index"
            :style="item.hidden == true ? 'display:none': 'display:flex'"
            @click="isShowSeach(navPlayData[index])"
          >
            <i>
              <svg class="icon icon-i" aria-hidden="true">
                <use :xlink:href="item.svgIcon"></use>
              </svg>
            </i>
            <div class="con-text">
              {{ item.title }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "NavPlay",
  data() {
    return {
      bool: false,
      navPlayData: [],
      // navPlayData: [
      //   { svgIcon: "#icon-wode", text: "我的" },
      //   { svgIcon: "#icon-sousuo", text: "搜索" },
      //   { svgIcon: "#icon-bangdan", text: "榜单" },
      //   { svgIcon: "#icon-tuijian", text: "推荐" },
      //   { svgIcon: "#icon-gedan", text: "歌单" },
      //   { svgIcon: "#icon-xiazai", text: "下载" },
      //   { svgIcon: "#icon-shezhi", text: "设置" },
      // ],
    };
  },
  created() {
    // console.log(this.$router.options.routes[0].children);
    this.navPlayData = this.$router.options.routes[0].children;
    // this.navList();
  },
  methods: {
    // navList(){
    //   let list = this.$router.options.routes[0].children;
    //   list.forEach(V => {
    //     console.log(V);
    //   });
    // },
    isShowSeach(item) {
      this.$router.push({ name: item.name });
    },
  },
};
</script>

<style lang="scss" scoped>
.navplay {
  height: 100%;
  z-index: 1000;
}
.nav-box {
  height: 100%;
  position: relative;
  width: 115px;
  // background-color: rgba(0, 0, 0, 0.2);
  background: -webkit-linear-gradient(
    top,
    hsla(0, 0%, 80%, 0.6),
    hsla(0, 0%, 80%, 0.6),
    hsla(0, 0%, 80%, 0.333333),
    hsla(0, 0%, 80%, 0),
    hsla(0, 0%, 80%, 0),
    hsla(0, 0%, 80%, 0)
  );
  overflow: hidden;
  transition: width 0.3s linear;

  &:hover {
    width: 360px;
    border-bottom-right-radius: 100%;
    transition: width 0.3s linear;
    background: -webkit-linear-gradient(
      top,
      hsla(0, 0%, 100%, 0.533333),
      hsla(0, 0%, 100%, 0.4),
      hsla(0, 0%, 100%, 0),
      hsla(0, 0%, 100%, 0)
    );
    color: #ffffff;
    .icon-i {
      color: #fff;
    }
  }
}
.nav-contain {
  margin-top: 120px;
}
// .con-bg{
//   height: 100%;
//   width: 115px;
//   position: absolute;
//   top: 0;
//   left: 0;
// background-color: rgba(0,0,0,0.5);
//   z-index: 9;
// }
.cont-list {
  z-index: 100;
  width: 200px;
  height: 50px;
  margin-top: 40px;
  padding: 5px 0;
  text-align: left;
  // background-color: red;
  display: flex;
  cursor: pointer;

  i {
    flex: 1;
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 20px 0 15px;
    .icon-i {
      width: 100%;
      height: 100%;
      color: #fff;
    }
  }
  .con-text {
    flex: 1;
    font-size: 30px;
    color: #fff;
    margin-top: 5px;
    align-items: center;
  }

  &:last-child {
    margin-top: 100px;
  }
  &:hover {
    font-weight: bold;
    font-size: 38px;

    i {
      transform: scale(1.4);
    }
    .con-text {
      transform: scale(1.3);
    }
  }
}
</style>
